package com.sun.login.presenter;

import com.sun.lib.base.basemvp.BasePresenter;
import com.sun.lib.base.basemvp.MvpView;
import com.sun.lib.base.basemvp.ViewRunnable;
import com.sun.lib.net.remote.StringObserver;
import com.sun.lib.rx.RxSchedules;
import com.sun.login.constants.Apis;
import com.sun.login.mvpview.LoginContract;

import java.util.HashMap;

/*
 *
 * #                                                   #
 * #                       _oo0oo_                     #
 * #                      o8888888o                    #
 * #                      88" . "88                    #
 * #                      (| -_- |)                    #
 * #                      0\  =  /0                    #
 * #                    ___/`---'\___                  #
 * #                  .' \\|     |# '.                 #
 * #                 / \\|||  :  |||# \                #
 * #                / _||||| -:- |||||- \              #
 * #               |   | \\\  -  #/ |   |              #
 * #               | \_|  ''\---/''  |_/ |             #
 * #               \  .-\__  '-'  ___/-. /             #
 * #             ___'. .'  /--.--\  `. .'___           #
 * #          ."" '<  `.___\_<|>_/___.' >' "".         #
 * #         | | :  `- \`.;`\ _ /`;.`/ - ` : | |       #
 * #         \  \ `_.   \_ __\ /__ _/   .-` /  /       #
 * #     =====`-.____`.___ \_____/___.-`___.-'=====    #
 * #                       `=---='                     #
 * #     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   #
 * #                                                   #
 * #               佛祖保佑         永无BUG              #
 * #                                                   #
 */

/**
 * Created by ESSC07 on 2020/11/19.
 */
/*public class LoginPresenter extends BasePresenter<LoginContract.LoginMvpView,LoginContract.Model> implements LoginContract.LoginImpl {
    @Override
    public void login() {
        checkViewAttached();
        dataManager.post(Apis.login,null)
                .compose(RxSchedules.<String>compose(disposables))
                .subscribe(new StringObserver() {
                    @Override
                    protected void onSuccess(String s) {
                        getMvpView().safeExecute(view -> {
                            view.loginSuccess();
                        });
                    }
                });
    }

}*/

public class LoginPresenter extends BasePresenter<LoginContract.LoginMvpView,LoginContract.Model> implements LoginContract.LoginImpl{

    @Override
    public void login() {
        getModel().login(new HashMap(), new StringObserver() {
            @Override
            protected void onSuccess(String s) {
                getMvpView().safeExecute(view -> {

                });
            }
        });
    }

}
